define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'user.unitarea/index',
        add_url: 'user.unitarea/add',
        edit_url: 'user.unitarea/edit',
        delete_url: 'user.unitarea/delete',
        export_url: 'user.unitarea/export',
        modify_url: 'user.unitarea/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh',
                [
                    {
                            text: '添加',
                            url: init.add_url,
                            method: 'open',
                            auth: 'add',
                            class: 'layui-btn layui-btn-normal layui-btn-sm',
                            icon: 'fa fa-plus ',
                           // extend: 'data-full="true"',
                        }
                    ],
                ],
                cols: [[
                    {field: 'id', title: 'id',search: false},
                    {field: 'unit_type', title: '户型'},
                    {field: 'area', title: '面积',search: false},
                    {field: 'create_time', title: '添加时间',search: false},
                    {width: 250, title: '操作', templet: ea.table.tool},

                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});